//
// Created by Nasa on 2024/7/24.
//

#include <iostream>
#include <vector>

using namespace std;
struct Node
{
    int value;
    Node *next;
};

//建立链表
Node *build(vector<int> v)
{
    Node *h = new Node{0, nullptr}, *p = h;
    for (int i = 0; i < v.size(); ++i)
    {
        p->next = new(Node);
        p->next->value = v[i];
        p = p->next;
    }
    p->next = nullptr;
    return h;
}

//打印链表
void printLinkedList(Node *h)
{
    Node *p = h->next;
    while (p != nullptr)
    {
        cout<<p->value;
        p=p->next;
    }
}
// 查找第一个为n的结点的位置(从0开始), 如果没找到返回-1

// 在第n个节点后插入值为x的结点,如果成功返回1,失败返回0

int main()
{
    vector<int> l = {5, 4, 3, 2, 1, 0};
    Node *head = build(l);
    printLinkedList(head);
//    cout << findLinkedList(head, 0) << endl;
//    cout << insertLinkedList(head, 0, 9) << endl;
//    printLinkedList(head);
    return 0;
}

